package com.yt.server.api.db;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import com.yt.server.db.utils.ClusterList;

public interface IDBManager {

	public void init(String path);

	public void startCache();

	public void startCache(boolean cache, int cacheTime, String cachePath);

	public void initCacheNewJndi(String dbPath);

	public void initNewJndi(String jndi, String dbUserName, String dbPassWord,
			String jdbcUrl, String driverClass);

	public void initNewJndi(String jndi, String dbUserName, String dbPassWord,
			String jdbcUrl, String driverClass, int initSize, int minPoolSize,
			int maxPoolSize, int maxStatements, int maxIdleTime);

	public void initSqliteJndi(String jndi, String jdbcUrl);

	public void initMysqlJndi(String jndi, String ip, String port,
			String dbName, String dbUserName, String dbPassWord);

	public Connection getConnection();

	public Connection getConnection(String jndi);

	public Connection getClusterConnection(String clusterJndi);

	public List<Connection> getClusterConnectionList(String clusterJndi);

	public ClusterList getClusterConnectionNameList(String clusterJndi);

	public int getNumIdleConection(String jndi) throws SQLException;

	public int getNumBusyConnection(String jndi) throws SQLException;

	public boolean testCheckoutConnection(String jndi) throws SQLException;

	public boolean isDBPoolExists(String jndi);
}